home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-10-16 | 57.5 KB | 2,079 lines |
- Newsgroups: comp.sources.misc
- From: aem@aber.ac.uk (Alec Muffett)
- Subject: v23i031: asp - The .plan description language, Part01/02
- Message-ID: <csm-v23i031=asp.150146@sparky.IMD.Sterling.COM>
- X-Md4-Signature: a582a60603763ef13c5629272c6fcb40
- Date: Fri, 27 Sep 1991 20:03:13 GMT
- Approved: kent@sparky.imd.sterling.com
-
- Submitted-by: aem@aber.ac.uk (Alec Muffett)
- Posting-number: Volume 23, Issue 31
- Archive-name: asp/part01
- Environment: UNIX
-
- [ The message "Remain Calm" comes to mind... :-) -Kent+ ]
-
- This is "Asp v3.2, The .plan description language".
- From the README:
-
- > Asp is a simplistic description language for carriage-return based ascii
- > animations, as commonly found in ".plan" files when you finger someone.
- > It is simple to use, so large, smooth, neat animations can be built
- > quickly and easily, and with a lot of room for imagination.
-
- Asp is a simple, rule-based language for generating those wonderful
- scrolling ".plan" files that many people have written diddy programs to
- generate. Asp was desigend to do go "one bit further" that those
- programs usually do, and to be flexible with it. It seems to achieve
- this end.
-
- I hope you have fun with it. The most obvious problem you might have is
- the standard index()/strchr() incompatibility. Check "asp.h"
-
- alec
- ---
- #!/bin/sh
- # This is a shell archive. Remove anything before this line, then unpack
- # it by saving it into a file and typing "sh file". To overwrite existing
- # files, type "sh file -c". You can also feed this as standard input via
- # unshar, or by typing "sh <file", e.g.. If this archive is complete, you
- # will see the following message at the end:
- # "End of archive 1 (of 2)."
- # Contents: COVER_LETTER MANIFEST Makefile README anim.c asp.c asp.h
- # copy.c demo1.asp demo2.asp demo3.asp demo4.asp demo5.asp display.c
- # Wrapped by aem@aberda on Wed Sep 25 11:26:45 1991
- PATH=/bin:/usr/bin:/usr/ucb ; export PATH
- if test -f 'COVER_LETTER' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'COVER_LETTER'\"
- else
- echo shar: Extracting \"'COVER_LETTER'\" \(1014 characters\)
- sed "s/^X//" >'COVER_LETTER' <<'END_OF_FILE'
- XThis is "Asp v3.2, The .plan description language"
- X
- XFrom the README:
- X
- X> Asp is a simplistic description language for carriage-return based ascii
- X> animations, as commonly found in ".plan" files when you finger someone.
- X> It is simple to use, so large, smooth, neat animations can be built
- X> quickly and easily, and with a lot of room for imagination.
- X
- XAsp is a simple, rule-based language for generating those wonderful
- Xscrolling ".plan" files that many people have written diddy programs to
- Xgenerate. Asp was desigend to do go "one bit further" that those
- Xprograms usually do, and to be flexible with it. It seems to achieve
- Xthis end.
- X
- XI hope you have fun with it. The most obvious problem you might have is
- Xthe standard index()/strchr() incompatibility. Check "asp.h"
- X
- Xalec
- X--
- XINET: aem@aber.ac.uk JANET: aem@uk.ac.aber BITNET: aem%aber@ukacrl
- XUUCP: ...!mcsun!ukc!aber!aem ARPA: aem%uk.ac.aber@nsfnet-relay.ac.uk
- XSNAIL: Alec Muffett, Computer Unit, Llandinam UCW, Aberystwyth, UK, SY23 3DB
- END_OF_FILE
- if test 1014 -ne `wc -c <'COVER_LETTER'`; then
- echo shar: \"'COVER_LETTER'\" unpacked with wrong size!
- fi
- # end of 'COVER_LETTER'
- fi
- if test -f 'MANIFEST' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'MANIFEST'\"
- else
- echo shar: Extracting \"'MANIFEST'\" \(897 characters\)
- sed "s/^X//" >'MANIFEST' <<'END_OF_FILE'
- X File Name Archive # Description
- X-----------------------------------------------------------
- X COVER_LETTER 1 letter to go with distribution
- X MANIFEST 1 This file
- X Makefile 1 Makefile (Oh, come on!!!)
- X README 1 documentation on programming ASP
- X anim.c 1 animation primitives
- X asp.c 1 main()
- X asp.h 1 header file with major declarations
- X copy.c 1 string copying primitives
- X demo1.asp 1 demo 1 of asp in action
- X demo2.asp 1 demo 2 of asp in action
- X demo3.asp 1 demo 3 of asp in action
- X demo4.asp 1 demo 4 of asp in action
- X demo5.asp 1 demo 5 of asp in action
- X display.c 1 display primitives
- X effects.c 2 special effects
- END_OF_FILE
- if test 897 -ne `wc -c <'MANIFEST'`; then
- echo shar: \"'MANIFEST'\" unpacked with wrong size!
- fi
- # end of 'MANIFEST'
- fi
- if test -f 'Makefile' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'Makefile'\"
- else
- echo shar: Extracting \"'Makefile'\" \(315 characters\)
- sed "s/^X//" >'Makefile' <<'END_OF_FILE'
- XEXE= asp
- XCFLAGS= -g
- XOBJECTS= anim.o asp.o copy.o display.o effects.o
- X
- Xdemo: $(EXE)
- X $(EXE) demo1.asp 2> /dev/null
- X $(EXE) demo2.asp 2> /dev/null
- X $(EXE) demo3.asp 2> /dev/null
- X $(EXE) demo4.asp 2> /dev/null
- X $(EXE) demo5.asp 2> /dev/null
- X
- X$(EXE): $(OBJECTS)
- X cc $(CFLAGS) -o $@ $(OBJECTS)
- X
- Xclean:
- X rm -f *.o asp
- END_OF_FILE
- if test 315 -ne `wc -c <'Makefile'`; then
- echo shar: \"'Makefile'\" unpacked with wrong size!
- fi
- # end of 'Makefile'
- fi
- if test -f 'README' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'README'\"
- else
- echo shar: Extracting \"'README'\" \(13120 characters\)
- sed "s/^X//" >'README' <<'END_OF_FILE'
- X*** Documentation for "asp v3.2, The .plan description language"
- X(c) Alec Muffett, September 1991
- X
- XAs detailed in the demonstration programs (just type 'make'), this is
- X"asp", Alec's Scrolling Program, a diddy little hack I put together to
- Xfinish a war over who could make the longest, best, and prettiest
- X".plan" files, using only the printable ascii character set.
- X
- XAsp is a simplistic description language for carriage-return based ascii
- Xanimations, as commonly found in ".plan" files when you finger someone.
- XIt is simple to use, so large, smooth, neat animations can be built
- Xquickly and easily, and with a lot of room for imagination.
- X
- XThe language is crude, I haven't put together a decent lexical analyser,
- Xthere is no real parser as such, to whit, it is a realio trulio hack, as
- Xstated before.
- X
- XThe language divides roughly into three sections: boring effects,
- Xspecial effects, and directives. A good idea of how they work can be
- Xobtained from the demo files supplied with this distribution, but here's
- Xa little primer anyway:-
- X
- X*** Primer
- X
- XAsp works by reading a "asp program" which is full of "rules" and
- X"data". A "rule" line is made up of a series of "commands", all of
- Xwhich begin with a "." character. With me so far ?
- X
- XSo, for example, a "rule" line might look like:-
- X
- X.clear .p .p .show .p .p
- X
- XSince the commands all begin with a dot, the rule line begins with a dot
- Xalso. Any line which begins with a dot in an asp program is assumed to
- Xbe a "rule" line. If a rule line is too long for convenience's sake, it
- Xmay be broken with a backslash at the end of the line, in the same way
- Xas in C and shell scripts, eg:
- X
- X.speed 2 \
- X.object his -30 40 \
- X.object dreams, -50 44 \
- X.object computer -15 22 \
- X.object he -2 58 \
- X.object ? -250 61 \
- X.object can 89 31 \
- X.object have 100 35 \
- X.object can 111 52 \
- X.object A 150 20 \
- X.object 't 200 55 \
- X.anim .resetanim .p .p .p .nl
- X
- X- is a single rule line. When a valid rule line is encountered, it is
- Xstored in memory and becomes the "current rule".
- X
- XNext, Data lines. Any non-blank line which is not a rule line, is a
- X"data line". When a data line is encountered, asp applies all the
- Xcommands specified in the current rule to the data line, and then moves
- Xonto the next data line. eg:
- X
- X.show .nl
- XHello World!
- X
- XWill print the line "Hello World!" (.show), and throw a linefeed (.nl).
- X
- XBlank lines in an asp program are ignored, and so, on occasions, dummy
- Xdata lines must be supplied to asp in order to get a rule to do
- Xanything. The traditional dummy line consists of two hyphens on a line
- Xof their own, eg:
- X
- X.p .p .p
- X--
- X
- XInvokes the Pause function (.p) three times. If there were no dummy
- Xline before the next rule was specified, the command would be ignored.
- XNote that the Pause function does not print anything on the standard
- Xoutput, so the appearance of the line is not changed.
- X
- XSimilarly, the command:
- X
- X.p .p .p
- X--
- X--
- X--
- X
- XInvokes Pause nine times, three times for each dummy line.
- X
- XNext, asp internals. Asp pinches an idea from the curses library, in
- Xthat it stores a copy of what the current output line looks like, and
- Xthen prints only the differences between the current line and what you
- Xwant it to look like. This "optimised refresh" improves on how an asp
- Xprogram looks when you view it, and also on the size of the output file
- Xasp generates compared to other scrolling programs.
- X
- XYou should also note that asp does not begin processing of a program
- Xuntil it encounters the first "rule line". Up to that point it behaves
- Xin the same way as the 'cat' program, copying the program to stdout.
- XThis allows you to embed a lot of plain text in your program before you
- Xstart scrolling things about.
- X
- X*** Undercoat
- X
- XThe above gives a fairly simple introduction to how asp works. Now for a
- Xdescription of commands in detail.
- X
- XThe asp commands break down into three rough types: Boring effects,
- XSpecial effects, and Directives. Some of these take arguments, which
- Xare either VALUES, BOOLEANS, or STRINGS.
- X
- XValues are basically any integer quantity, positive or negative.
- X
- XBooleans are the same as values, where 0=FALSE and Non-0=TRUE.
- X
- XStrings are continuous sets of characters which do not contain
- Xwhitespace (I haven't bothered in putting an escaping mechanism for
- Xspaces yet.)
- X
- XThere may be a problem if you specify a string as an argument to a
- Xcommand, and the string happens to begin with a dot - asp will, at some
- Xpoint, try to treat it as a command. Don't worry about this, it will
- Xprobably work out okay, and I'll fix it in due course.
- X
- XFinally, please note that asp uses only columns 0->78 of the screen,
- Xbecause some terminals will wrap immediately you write a character into
- Xcolumn 79, and this spoils the fun...
- X
- XIMPORTANT: Asp does not expand TABs in asp programs. Run your program
- Xthrough "expand" before feeding it into "asp".
- X
- X*** Topcoat
- X
- XHere is a list of asp directives and effects, their function and arguments:
- X
- X-------------------------------
- XDIRECTIVES AND BORING EFFECTS:-
- X-------------------------------
- X .clear
- X
- XWipes the current line clear and refreshes it, so as to put a blank line
- Xon screen.
- X-------------------------------
- X .wipe
- X
- XWipes the current line clear without refreshing it, so that the next
- Xcommand does not have to worry about the mess left by previous lines.
- X
- XThis command is probably best tagged onto the beginning of every rule
- Xwhere you do not want to have to specifically overstrike anything that
- Xwas left by the previous rule & data.
- X-------------------------------
- X .nl
- X
- XThrows a newline. Please note that the default action of asp once it
- Xhas acquired a rule it to print EVERYTHING without newlines, so you must
- Xbe explicit about where you want them.
- X-------------------------------
- X .show
- X
- XDoes a .wipe and then prints the current line on screen. This is the
- Xmost basic of the output primitives, and you will probably use this a
- Xlot.
- X-------------------------------
- X .p
- X
- XGenerates a pause in the display by firing approximately 2Kb of carriage
- Xreturns at your screen (roughly 1 second at 9600 baud). See also
- X".speed" below.
- X-------------------------------
- X .noop
- X
- XDoes bugger all.
- X-------------------------------
- X .flush
- X
- XIs a nice one. It deletes the current rule from asp's memory, so it's
- Xbehaviour is once again like 'cat' (check the 'Undercoat' section,
- Xabove). This means you can embed small bits of asp code in any text
- Xfile, without having to modify the rest of the file to get it through
- Xthe asp processor. Do NOT forget to invoke ".flush" with a dummy data
- Xline, though:
- X
- XThis is a bit of cat'ted text.
- X.speed 3 .spatter .p .p .p .nl
- XThis is a somewhat longer bit of asp'ed text
- X.flush
- X--
- XThis is another bit of cat'ted text.
- X
- X- ok ?
- X-------------------------------
- X .smooth BOOLEAN
- X
- XSwitches on 80-character smoothing mode. This is useful where you are
- Xgoing to be scrolling small bits of text back and forth across the
- Xscreen. If you do not have smoothing on, asp will generate code which
- Xwill make the object move faster towards the left hand side of the
- Xscreen. This is due to the optimised refresh code mentioned above.
- X
- XIf smoothing is swithched on (".smooth 1"), asp pads out (with carriage
- Xreturns) each line that it prints in order to remedy this situation.
- XThis leads to smoother, neater animations.
- X-------------------------------
- X .speed VALUE
- X
- XThis is a speed adjustment function which pads out each line that asp
- Xsends, in order to cope with fast terminals, and for special effects.
- X
- XThe default is ".speed 0" and as the speed value is increased, each line
- Xis padded with 'x' carriage returns (x = 8 * n, where 'n' is the
- Xargument to ".speed"). The higher the value, the slower it goes.
- X
- XBe judicious with your use of .speed - remember, some people still work
- Xat under 1200 baud.
- X-------------------------------
- X .background
- X .foreground
- X
- XThese are both commands which break the rules outlined above. They both
- Xread the next line DIRECTLY BENEATH the command into special buffers for
- Xuse during output. It does not matter whether this line is blank or
- Xnot, and indeed, a blank line will be necessary to reset the buffer to a
- Xblank when desired.
- X
- X".background" and ".foreground" load their following line into a
- Xbackground or foreground buffer respectively. The buffer will then be
- Xused either be used as a backdrop or overlay mask for whatever is
- Xprinted from then on. This means that you don't have to worry about
- Xyour landscapes getting corrupted, having to redraw them, and so on.
- X
- XAs an example, see the two occurances of ".background" in "demo2.asp"
- X-------------------------------
- XSPECIAL EFFECTS:-
- X-------------------------------
- X .fade
- X
- XPrints the message on the screen and fades it one character at a time.
- XTo get slower fades, whack the speed up either side of it, eg:
- X
- X.show .p .p .speed 10 .fade .speed 0 .p
- X This piece of text should fade quite gradually into nothingness...
- X
- X-------------------------------
- X .flash
- X
- XFlashes all the text in a data line several times before moving onto the
- Xnext. Does not overstrike text with whitespace, and can be used thusly:
- X
- X.show
- X"Beep Beep", went the little car's horn.
- X.speed 20 .flash .speed 0
- X Beep Beep
- X
- X-------------------------------
- X .layb
- X .layetm
- X .laymte
- X .layf
- X
- XPrints the line by laying down one character at a time, backwards,
- Xends-to-middle, middle-to-ends, or forwards, respectively. See the
- Xdemos for examples.
- X-------------------------------
- X .tshow
- X
- XIs like ".show" but does not call ".wipe", and it uses transparent
- Xwhitespace, ie: whitespace in the data line does not overstrike any
- Xprintable character that is already on screen. eg:
- X
- X.tshow .p
- X LIFE
- X ON
- X UNIX
- X
- X-------------------------------
- X .letter1
- X .letter2
- X .letter3
- X
- XAre effects macros based on the "let's-cycle-through-the-ascii-character-set"
- Xprinciple. See the demos for examples.
- X-------------------------------
- X .scrollb
- X .scrollf
- X
- XScrolls the data line backwards or forwards (respectively) onto the
- Xscreen, overstriking what is already there, eg:
- X
- X.scrollb .p .p
- XThis message will scroll from right to left across the width of the screen
- XThis message will also scroll from right to left.
- X
- X-------------------------------
- X .scrollob
- X .scrollof
- X
- XLike .scroll[bf], but these commands scroll what it already there off of
- Xthe screen, rather than overstriking it. See the demos for examples.
- X
- X.scrollob .p .p
- XThis message will scroll from right to left across the width of the screen
- XThis message will also scroll from right to left, without overstriking.
- X
- X-------------------------------
- X .spatter
- X .wspatter
- X
- X".spatter" is the opposite of ".fade". ".wspatter" is similar, but
- Xspatters whole words onto the screen, rather than characters.
- X-------------------------------
- X .object STRING1 VALUE1 VALUE2
- X .anim
- X .resetanim
- X
- XThese are the three Asp animation primitives.
- X
- XBasically, the idea of an animation is to build up a series of "objects"
- Xusing the ".object" directive. This specifies that you want to move
- X"STRING1" from position VALUE1 to position VALUE2, where the value is
- Xbetween +/-37267 (or possibly larger), and position 0 is the left hand
- Xcolumn of the screen, position 78 the right hand corner of the screen.
- X
- XAfter specifying the series of objects to be animated, the animation is
- Xrun by invoking the ".anim" command. Once you are finished with the
- Xanimation, you delete the objects from the screen by the ".resetanim"
- Xcommand. Simple, eh ? Here's the lorry animation from demo1.asp:
- X
- X.object oo-oP -15 80 .anim .resetanim .p
- X--
- X
- XClever people will see that if you want to produce delays and odd timing
- Xeffects, you merely have to start an object a long way away from it's
- Xdestination. eg: several lorries-
- X
- X.object oo-oP -15 80 \
- X.object oo-oP -21 80 \
- X.object oo-oP -27 80 \
- X.object oo-oP -33 80 \
- X.object oo-oP -39 80 \
- X.object ooo-----ooP -45 80 \
- X.anim .resetanim .p
- X--
- X
- XBecause their nature is that of a sort of "compound command", several
- Xanimations can be built into a single rule and then fired off upon
- Xmultiple data lines. Add a few extra dummy lines to the animation above
- Xto get a whole convoy. (see also the "flying arrows" in demos 3 & 5).
- X
- XFor the technically minded, asp animations run in an entirely separate
- Xbuffer from the rest of asp. The buffer lies in the second position
- Xthus:-
- X
- X USER VIEW
- X |
- X V
- X FOREGROUND BUFFER
- X ANIMATIONS BUFFER
- X RULE BUFFER (STDLINE)
- X BACKGROUND BUFFER
- X
- XHence, what you do in an animation cannot affect the rule buffer (ie:
- Xwhere your data lines end up after being processed by a rule), nor the
- Xforegrounds and backgrounds.
- X
- X*** Usage
- X
- XNow for the easy bit: for your file "aspprog.asp";
- X
- X asp aspprog.asp > $HOME/.plan
- X
- Xor, if you must use tabs
- X
- X expand < aspprog.asp | asp > $HOME/.plan
- X
- XBugs, reports, suggestions, patches to the address below...
- X
- X alec 8-)
- X--
- XINET: aem@aber.ac.uk JANET: aem@uk.ac.aber BITNET: aem%aber@ukacrl
- XUUCP: ...!mcsun!ukc!aber!aem ARPA: aem%uk.ac.aber@nsfnet-relay.ac.uk
- XSNAIL: Alec Muffett, Computer Unit, Llandinam UCW, Aberystwyth, UK, SY23 3DB
- END_OF_FILE
- if test 13120 -ne `wc -c <'README'`; then
- echo shar: \"'README'\" unpacked with wrong size!
- fi
- # end of 'README'
- fi
- if test -f 'anim.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'anim.c'\"
- else
- echo shar: Extracting \"'anim.c'\" \(1621 characters\)
- sed "s/^X//" >'anim.c' <<'END_OF_FILE'
- X/*
- X * This code is copyright ADE Muffett, September 1991, and is distributed as
- X * part of the ASP .plan description language compiler. This code is freely
- X * redistributable as long as this copyright notice remains intact. No
- X * responsibility is assumed by the author for any situation which arises
- X * from the use of this code, including insanity, late nights, or disk
- X * storage problems.
- X */
- X
- X#include "asp.h"
- X
- Xvoid
- XAddObject (string)
- X char *string;
- X{
- X register int i;
- X int start;
- X int finish;
- X char buff[SCREENWIDTH];
- X char *obj;
- X
- X sscanf (string, "%*s %s %d %d", buff, &start, &finish);
- X
- X obj = CopyString (buff);
- X
- X for (i = 0; aobjects[i].object && (i < MAX_ANIM_OBJS - 1); i++);
- X
- X aobjects[i].object = obj;
- X aobjects[i].location = start;
- X aobjects[i].destination = finish;
- X aobjects[++i].object = NULL;
- X}
- X
- Xvoid
- XResetAnim ()
- X{
- X aobjects[0].object = NULL;
- X NullSet (anim_buffer, sizeof (anim_buffer));
- X}
- X
- Xvoid
- XAnimate ()
- X{
- X register int i;
- X struct anim_object *ap;
- X int changed;
- X
- X for (changed = 1; changed; /* nothing */ )
- X {
- X changed = 0;
- X NullSet (anim_buffer, sizeof (anim_buffer));
- X SpaceFlood (anim_buffer, SCREENWIDTH);
- X
- X for (i = 0; aobjects[i].object && (i < MAX_ANIM_OBJS - 1); i++)
- X {
- X ap = &aobjects[i];
- X
- X LimCopy (anim_buffer, ap -> object, ap -> location);
- X if (ap -> location > ap -> destination)
- X {
- X ap -> location--;
- X changed++;
- X } else if (ap -> location < ap -> destination)
- X {
- X ap -> location++;
- X changed++;
- X }
- X }
- X /* anim_buffer is dealt with in Update() for masking reasons */
- X UpdateCR ();
- X }
- X}
- END_OF_FILE
- if test 1621 -ne `wc -c <'anim.c'`; then
- echo shar: \"'anim.c'\" unpacked with wrong size!
- fi
- # end of 'anim.c'
- fi
- if test -f 'asp.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'asp.c'\"
- else
- echo shar: Extracting \"'asp.c'\" \(6734 characters\)
- sed "s/^X//" >'asp.c' <<'END_OF_FILE'
- X/*
- X * This code is copyright ADE Muffett, September 1991, and is distributed as
- X * part of the ASP .plan description language compiler. This code is freely
- X * redistributable as long as this copyright notice remains intact. No
- X * responsibility is assumed by the author for any situation which arises
- X * from the use of this code, including insanity, late nights, or disk
- X * storage problems.
- X */
- X
- X/* Unix is a Bellmark of Lab Tradeoratories */
- X
- X#include "asp.h"
- X#undef TESTING
- X
- X/* GLOBAL DATA */
- Xint speed;
- Xint smooth;
- Xchar stdline[SCREENWIDTH + 1];
- Xchar anim_buffer[SCREENWIDTH + 1];
- Xchar foreground[SCREENWIDTH + 1];
- Xchar background[SCREENWIDTH + 1];
- Xstruct anim_object aobjects[MAX_ANIM_OBJS];
- X/* END OF GLOBAL DATA */
- X
- Xstruct command_structure
- X{
- X char *codeword;
- X void (*fn) ();
- X char has_args;
- X};
- X
- Xstruct command_call
- X{
- X int c_index;
- X char *invocation;
- X};
- X
- Xstatic FILE *fp;
- Xstatic char version[] = "asp3.2(c)aem@aber";
- Xstatic struct command_call command_calls[COMMAND_COUNT];
- Xstatic struct command_structure command_name[COMMAND_COUNT];
- X
- Xvoid
- XSmooth (command)
- X char *command;
- X{
- X sscanf (command, "%*s %d", &smooth);
- X}
- X
- Xvoid
- XSpeed (command)
- X char *command;
- X{
- X sscanf (command, "%*s %d", &speed);
- X}
- X
- Xvoid
- XFlush ()
- X{
- X command_calls[0].c_index = 0;
- X}
- X
- Xchar *
- XBuildArgs (commstring, name_index)
- X char *commstring;
- X int name_index;
- X{
- X char cbuf[255];
- X
- X if (!strcmp (command_name[name_index].codeword, ".object") ||
- X !strcmp (command_name[name_index].codeword, ".speed") ||
- X !strcmp (command_name[name_index].codeword, ".smooth"))
- X {
- X return (CopyString (commstring));
- X }
- X if (!strcmp (command_name[name_index].codeword, ".foreground"))
- X {
- X fgets (cbuf, 255, fp);
- X NullSet (foreground, sizeof (foreground));
- X strncpy (foreground, cbuf, SCREENWIDTH);
- X return ((char *) NULL);
- X }
- X if (!strcmp (command_name[name_index].codeword, ".background"))
- X {
- X fgets (cbuf, 255, fp);
- X NullSet (background, sizeof (background));
- X strncpy (background, cbuf, SCREENWIDTH);
- X return ((char *) NULL);
- X }
- X fprintf (stderr, "%s: NYI\n", commstring);
- X return ((char *) 0);
- X}
- X
- Xvoid
- XNewFunction (cw, fn, args)
- X char *cw;
- X void (*fn) ();
- X char args;
- X{
- X static int command_count = 1; /* load commands from 1st element */
- X
- X command_name[command_count].codeword = cw;
- X command_name[command_count].fn = fn;
- X command_name[command_count].has_args = args;
- X command_count++;
- X command_name[command_count].codeword = NULL;
- X}
- X
- Xvoid
- XParseCommands (cstring)
- X register char *cstring;
- X{
- X int i;
- X int comm_number;
- X char *ptr;
- X int get_next_line;
- X char otherbuffer[255];
- X static char dot = '.';
- X
- X comm_number = 0;
- X command_calls[comm_number].c_index = 0;
- X
- X start_parsing:
- X i = strlen (cstring) - 1;
- X if (cstring[i] == '\\')
- X {
- X get_next_line = 1;
- X cstring[i] = '\0';
- X } else
- X {
- X get_next_line = 0;
- X }
- X
- X for (ptr = (char *) strchr (cstring, dot);
- X ptr;
- X ptr = (char *) strchr (ptr, dot))
- X {
- X if (!*ptr) /* no more commands */
- X {
- X break;
- X }
- X for (i = 1; command_name[i].codeword; i++)
- X {
- X if (!strncmp (ptr, command_name[i].codeword,
- X strlen (command_name[i].codeword)))
- X {
- X command_calls[comm_number].c_index = i;
- X
- X if (command_name[i].has_args != 'Y')
- X {
- X command_calls[comm_number].invocation = (char *) 0;
- X comm_number++;
- X break;
- X } else
- X {
- X command_calls[comm_number].invocation = BuildArgs (ptr, i);
- X comm_number++;
- X break;
- X }
- X }
- X }
- X
- X if (!command_name[i].codeword)
- X {
- X fprintf (stderr, "Error: unknown command '%s'\n", ptr);
- X }
- X ptr++; /* make this neater */
- X }
- X if (get_next_line)
- X {
- X fgets (otherbuffer, 255, fp);
- X Trim (otherbuffer);
- X cstring = otherbuffer;
- X goto start_parsing;
- X }
- X command_calls[comm_number++].c_index = 0;
- X}
- X
- Xvoid
- XExecuteCommandsOn (dstring)
- X register char *dstring;
- X{
- X register int i;
- X register int j;
- X
- X for (i = 0; command_calls[i].c_index; i++)
- X {
- X j = command_calls[i].c_index;
- X#ifdef TESTING
- X printf ("executing '%s' as '%s' on \n'%s'\n", command_name[j].codeword,
- X command_calls[i].invocation, dstring);
- X#else
- X (*command_name[j].fn) (command_calls[i].invocation, dstring);
- X#endif
- X }
- X}
- X
- Xint
- Xmain (argc, argv)
- X int argc;
- X char *argv[];
- X{
- X char command_buffer[255];
- X char line_buffer[255];
- X register char *ptr;
- X register int i;
- X static char dot = '.';
- X
- X srand (time (0));
- X
- X NewFunction (".wspatter", WordSpatter, 'N');
- X NewFunction (".wipe", Wipe, 'N');
- X NewFunction (".tshow", TShow, 'N');
- X NewFunction (".speed", Speed, 'Y');
- X NewFunction (".spatter", Spatter, 'N');
- X NewFunction (".smooth", Smooth, 'Y');
- X NewFunction (".show", Show, 'N');
- X NewFunction (".scrollof", ScrollOffForward, 'N');
- X NewFunction (".scrollob", ScrollOffBackward, 'N');
- X NewFunction (".scrollf", ScrollForward, 'N');
- X NewFunction (".scrollb", ScrollBackward, 'N');
- X NewFunction (".reset", ResetAnim, 'N');
- X NewFunction (".p", Pause, 'N');
- X NewFunction (".object", AddObject, 'Y');
- X NewFunction (".noop", Noop, 'N');
- X NewFunction (".nl", LineFeed, 'N');
- X NewFunction (".macro", NULL, 'N');
- X NewFunction (".letter3", Letter3, 'N');
- X NewFunction (".letter2", Letter2, 'N');
- X NewFunction (".letter1", Letter1, 'N');
- X NewFunction (".laymte", LayMiddleToEnds, 'N');
- X NewFunction (".layf", LayForward, 'N');
- X NewFunction (".layetm", LayEndsToMiddle, 'N');
- X NewFunction (".layb", LayBackward, 'N');
- X NewFunction (".foreground", Noop, 'Y');
- X NewFunction (".flush", Flush, 'N');
- X NewFunction (".flash", Flash, 'N');
- X NewFunction (".fade", Fade, 'N');
- X NewFunction (".clear", Clear, 'N');
- X NewFunction (".background", Noop, 'Y');
- X NewFunction (".anim", Animate, 'N');
- X
- X if (isatty (fileno (stdin)))
- X {
- X if (argc == 1)
- X {
- X fprintf (stderr, "Usage:\t%s <filename>\n", argv[0]);
- X exit (1);
- X }
- X fp = fopen (argv[1], "r");
- X if (!fp)
- X {
- X perror (argv[1]);
- X exit (1);
- X }
- X } else
- X {
- X fp = stdin;
- X }
- X
- X for (*line_buffer = '\0'; !feof (fp); *line_buffer = '\0')
- X {
- X fgets (line_buffer, 255, fp);
- X
- X if (!*line_buffer || *line_buffer == '\n') /* allow blank lines */
- X {
- X if (!command_calls[0].c_index)
- X {
- X putchar ('\n');
- X }
- X continue;
- X }
- X Trim (line_buffer); /* trim w/s */
- X
- X if (*line_buffer == dot)
- X {
- X ParseCommands (line_buffer);
- X continue;
- X }
- X if (!command_calls[0].c_index) /* don't faff around... */
- X {
- X printf ("%s\n", line_buffer);
- X continue;
- X }
- X ExecuteCommandsOn (line_buffer);
- X }
- X fclose (fp);
- X
- X printf ("\n\r%s\r", version);
- X i = strlen (version);
- X while (i--)
- X {
- X putchar (' ');
- X }
- X putchar ('\r');
- X
- X return (0);
- X}
- END_OF_FILE
- if test 6734 -ne `wc -c <'asp.c'`; then
- echo shar: \"'asp.c'\" unpacked with wrong size!
- fi
- # end of 'asp.c'
- fi
- if test -f 'asp.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'asp.h'\"
- else
- echo shar: Extracting \"'asp.h'\" \(2427 characters\)
- sed "s/^X//" >'asp.h' <<'END_OF_FILE'
- X/*
- X * This code is copyright ADE Muffett, September 1991, and is distributed as
- X * part of the ASP .plan description language compiler. This code is freely
- X * redistributable as long as this copyright notice remains intact. No
- X * responsibility is assumed by the author for any situation which arises
- X * from the use of this code, including insanity, late nights, or disk
- X * storage problems.
- X */
- X
- X#include <stdio.h>
- X
- X#define USE_INDEX /* use index instead of strchr() */
- X#define SCREENWIDTH 79 /* colourbook screws you up */
- X#define COMMAND_COUNT 1024 /* max number of commands in a rule */
- X#define LOOP_COUNT 2048 /* several things, eg: delay loop */
- X#define MAX_ANIM_OBJS 512 /* maximum number of objects in an anim */
- X#define DUMMY_RETURNS 8 /* speed 0 = 0; 1 = 64, 2 = 128... */
- X#define NUM_FLASH 16 /* number of flashes for 1 ".flash" */
- X
- X/* strdup() if you have it... */
- X#define CopyString(xxx) ((char *)strcpy((char *)malloc(strlen(xxx)+1), xxx))
- X
- X#ifdef USE_INDEX
- X#define strchr(a,b) index(a,b)
- X#endif
- X
- Xstruct anim_object
- X{
- X char *object;
- X int location;
- X int destination;
- X};
- X
- Xextern char *BuildArgs ();
- Xextern char *Memcpy ();
- Xextern char anim_buffer[SCREENWIDTH + 1];
- Xextern char background[SCREENWIDTH + 1];
- Xextern char foreground[SCREENWIDTH + 1];
- Xextern char stdline[SCREENWIDTH + 1];
- Xextern int Update ();
- Xextern int smooth;
- Xextern int speed;
- Xextern struct anim_object aobjects[MAX_ANIM_OBJS];
- Xextern void AddObject ();
- Xextern void Animate ();
- Xextern void CReturn ();
- Xextern void Clear ();
- Xextern void ExecuteCommandsOn ();
- Xextern void Fade ();
- Xextern void Flash ();
- Xextern void Flush ();
- Xextern void LayBackward ();
- Xextern void LayEndsToMiddle ();
- Xextern void LayForward ();
- Xextern void LayMiddleToEnds ();
- Xextern void Letter1 ();
- Xextern void Letter2 ();
- Xextern void Letter3 ();
- Xextern void LimCopy ();
- Xextern void LineFeed ();
- Xextern void NewFunction ();
- Xextern void Noop ();
- Xextern void NullSet ();
- Xextern void Overlay ();
- Xextern void ParseCommands ();
- Xextern void Pause ();
- Xextern void ResetAnim ();
- Xextern void ScrollBackward ();
- Xextern void ScrollForward ();
- Xextern void ScrollOffBackward ();
- Xextern void ScrollOffForward ();
- Xextern void Show ();
- Xextern void Smooth ();
- Xextern void SpaceFlood ();
- Xextern void Spatter ();
- Xextern void Speed ();
- Xextern void TShow ();
- Xextern void TransparentOverlay ();
- Xextern void Trim ();
- Xextern void UpdateCR ();
- Xextern void Wipe ();
- Xextern void WordSpatter ();
- END_OF_FILE
- if test 2427 -ne `wc -c <'asp.h'`; then
- echo shar: \"'asp.h'\" unpacked with wrong size!
- fi
- # end of 'asp.h'
- fi
- if test -f 'copy.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'copy.c'\"
- else
- echo shar: Extracting \"'copy.c'\" \(1840 characters\)
- sed "s/^X//" >'copy.c' <<'END_OF_FILE'
- X/*
- X * This code is copyright ADE Muffett, September 1991, and is distributed as
- X * part of the ASP .plan description language compiler. This code is freely
- X * redistributable as long as this copyright notice remains intact. No
- X * responsibility is assumed by the author for any situation which arises
- X * from the use of this code, including insanity, late nights, or disk
- X * storage problems.
- X */
- X
- X#include "asp.h"
- X
- X/* alas, for ANSI... */
- Xchar *
- XMemcpy (to2, from, num)
- X char *to2;
- X register char *from;
- X register int num;
- X{
- X register char *to = to2;
- X
- X while (num--)
- X {
- X *(to++) = *(from++);
- X }
- X return (to2);
- X}
- X/* Set a buffer to be full of nulls */
- Xvoid
- XNullSet (string, num)
- X register char *string;
- X register int num;
- X{
- X while (num--)
- X {
- X *(string++) = '\0';
- X }
- X}
- X/* Set all nulls in a buffer to be whitespace */
- Xvoid
- XSpaceFlood (string, num)
- X register char *string;
- X register int num;
- X{
- X while (num--)
- X {
- X if (!*string)
- X {
- X *string = ' ';
- X }
- X string++;
- X }
- X}
- X/* copy source to destination without adding trailing null */
- Xvoid
- XOverlay (destination, source)
- X register char *destination;
- X register char *source;
- X{
- X while (*source)
- X {
- X *(destination++) = *(source++);
- X }
- X}
- X/* copy source to destination without adding trailing null, except whitespace */
- Xvoid
- XTransparentOverlay (destination, source)
- X register char *destination;
- X register char *source;
- X{
- X while (*source)
- X {
- X if (*source != ' ')
- X {
- X *destination = *source;
- X }
- X source++;
- X destination++;
- X }
- X}
- X/* copy into a bounded buffer */
- Xvoid
- XLimCopy (to, from, start)
- X register char *to;
- X register char *from;
- X register int start;
- X{
- X while (*from)
- X {
- X if (start >= 0 && start < SCREENWIDTH)
- X {
- X to[start] = *from;
- X }
- X from++;
- X start++;
- X }
- X}
- X/* END OF COPY PRIMITIVES */
- END_OF_FILE
- if test 1840 -ne `wc -c <'copy.c'`; then
- echo shar: \"'copy.c'\" unpacked with wrong size!
- fi
- # end of 'copy.c'
- fi
- if test -f 'demo1.asp' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'demo1.asp'\"
- else
- echo shar: Extracting \"'demo1.asp'\" \(132 characters\)
- sed "s/^X//" >'demo1.asp' <<'END_OF_FILE'
- X.smooth 1 .speed 25
- X--
- X.show .p .p
- X Beware the M25 - heavy lorries !
- X.object oo-oP -15 80 .anim .resetanim .p
- X--
- END_OF_FILE
- if test 132 -ne `wc -c <'demo1.asp'`; then
- echo shar: \"'demo1.asp'\" unpacked with wrong size!
- fi
- # end of 'demo1.asp'
- fi
- if test -f 'demo2.asp' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'demo2.asp'\"
- else
- echo shar: Extracting \"'demo2.asp'\" \(3930 characters\)
- sed "s/^X//" >'demo2.asp' <<'END_OF_FILE'
- X.smooth 1
- X
- X.nl .nl .nl .p .show .p
- X******************* scrolling enterprises proudly presents:- *******************
- X
- X.scrollob
- X--------------------------------------------------------------------------------
- X
- X.show .p .p .fade
- X----------------------(A Roadrunner>>>++>> Production)--------------------------
- X
- X.spatter .p .p .fade
- X----------------------------- DAVID ATTENBOROUGH'S -----------------------------
- X
- X.tshow .p
- X LIFE
- X ON
- X UNIX
- X
- X.clear .scrollf .p .fade .p
- XHello and good evening. 8)
- X
- X.show .p .p
- XTonight we are going to examine the sex life of that rare and elusive creature,
- XThe Andalusian Video Snail.
- X
- X.object \@_ 85 40 .anim .resetanim .p
- X--
- X.object \@_ 40 40 .object ? 38 38 .anim .resetanim .p
- X--
- X.object _@_ 40 40 .anim .resetanim
- X--
- X.object _@/ 40 85 .anim .resetanim
- X--
- X
- X.fade
- XThe Andalusian Video Snail.
- X
- X.show .p .p
- X
- XYes, this small and unobtrusive gastropod, which has never before been studied
- Xin it's native habitat, has confused biologists for years; feeding as it does
- X
- X.show .p .object _@/ -5 80 .anim .resetanim .p
- Xupon the core dumps and executable images to be found on large UNIX mainframes.
- X
- X.clear
- X--
- X
- X.show .p .p
- XIt derives nourishment from bad blocks and thrives on operating systems where
- Xkernel crashes are frequent. There is some evidence to suggest that they are
- Xthe original computer 'bugs', but this would then be a misnomer, because they
- Xare, of course, actually snails.
- X
- X.object \@_ 80 34 .anim .resetanim .p
- X--
- X.object _@_ 34 34 .anim .resetanim .p
- X--
- X.object _!_ 34 34 .anim .resetanim .p
- X--
- X.object _@_ 34 34 .anim .resetanim .p
- X--
- X.object _@/ 34 80 .anim .resetanim .p
- X--
- X
- X.clear
- X--
- X
- X.show .p .p
- XNo-one has yet captured one of these creatures, for whenever a snail happens
- Xonto the screen of a VDU, it immediately vanishes once the terminal has been
- Xdisconnected from the network. After searching the length and breadth of the
- Xnetwork, we are now able to bring you pictures of the extraordinary courtship
- Xand mating rituals of these snails...
- X
- X.fade .p .clear
- Xand mating rituals of these snails...
- X
- X.show .p .p .clear .nl
- X (photographs courtesy of the digital corporation)
- X.show .nl
- X ___/--~ ~~~\____
- X _/\/ \_
- X /\ _/ ||\_
- X / \/\_ / ~ \_
- X
- X.background
- X\___/ \__/ \_
- X
- X.tshow .p .wipe
- X (ANDALUSIA)
- X
- X.object _@/ -20 37 .anim .p
- X--
- X
- X.object \@_ 100 62 .anim
- X--
- X
- X.object ? 60 60 .anim .p .resetanim
- X--
- X
- X.object _@/ 37 37 \
- X.object \@_ 62 62 .anim .p
- X--
- X
- X.object ! 60 60 .anim .p .resetanim
- X--
- X
- X.object _@/ 37 37 \
- X.object \@_ 60 40 \
- X.anim .p .resetanim
- X--
- X
- X.show .p
- X (let us draw a delicate veil over these proceedings)
- X
- X.show .p .p
- X {}{}{}CENSORED{}{}{}
- X
- X.object _@/ 40 60 \
- X.object \@_ 40 -5 \
- X.object {}{}{}CENSORED{}{}{} 30 30 \
- X.anim .p .resetanim
- X--
- X
- X.object {}{}{}CENSORED{}{}{} 30 30 \
- X.object _@_ 60 60 \
- X.anim .p
- X--
- X
- X.object <ZZZzzz...> 63 63 \
- X.anim .p .resetanim .clear
- X--
- X
- X.laymte .p .wipe
- X - THE END -
- X
- X.background
- X
- X.wipe .nl .nl
- X--
- X
- X.layetm .p .clear
- X This educational program has been brought to you by:-
- X
- X.show .p .wipe
- X The numbers 4 and 17
- X The letter 'Q'
- X and also...
- X.spatter .p .nl .wipe .p
- X Alec D.E. Muffett
- X Roadrunner>>>++>>
- X (using asp 3.2)
- X
- X.scrollf .p .wipe
- X [Next week we investigate the habits of the Lothian Software Wombat.]
- X
- X.nl .nl
- X--
- END_OF_FILE
- if test 3930 -ne `wc -c <'demo2.asp'`; then
- echo shar: \"'demo2.asp'\" unpacked with wrong size!
- fi
- # end of 'demo2.asp'
- fi
- if test -f 'demo3.asp' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'demo3.asp'\"
- else
- echo shar: Extracting \"'demo3.asp'\" \(4739 characters\)
- sed "s/^X//" >'demo3.asp' <<'END_OF_FILE'
- X.smooth 1 .p
- X--
- X
- X.wspatter .p .p .p .fade
- X (C) ADE Muffett, UCW Aberystwyth, 1991. "aem@aber.ac.uk" "...!ukc!aber!aem"
- X
- X.spatter .p .p .fade .p
- X A Roadrunner>>>++>> production
- X
- X.show .p .p .clear
- X Hello there.
- X I bet you're wondering what I've been up to of late.
- X On the other hand maybe you haven't.
- X Perhaps you don't know about scrolling ".plan" files at all ?
- X
- X.p .p
- X--
- X
- X.show .p .p .wipe
- X You see (for those newcomers amongst you), a long time ago, two undergraduates
- X here in Aberystwyth decided to have a 'war'.
- X
- X.p .p
- X--
- X
- X.show .p .p .clear
- X They were (are) Alun Jones "alj8" and Kev Brooks "kkb9".
- X
- X.p .p
- X--
- X
- X.show .p .p .clear
- X The war was over who could produce the 'prettiest' ".plan" file.
- X
- X.p .p
- X--
- X
- X.show .p .p .wipe
- X They fought tooth and nail, with many people watching on the sidelines.
- X Letters scrolled on and off the screen, flashed at you, it was quite amusing.
- X
- X.p .p
- X--
- X
- X.scrollob .p .p
- X But then one day, I saw one effort (Kev's) that was really appalling:
- X A huge data file that flashed, flickered and grunged its way across the
- X screen, and I thought to myself :- "I can do much better than that!"
- X
- X.p .p
- X--
- X
- X.show .p .p .clear
- XI think that in retrospect I was right. 8)
- XI sat down, and I wrote "ASP" :-
- X
- X.show .nl .p .p .wipe
- XAlec's Scrolling Program: a description language for plan files
- X - written in fairly portable C
- X - with a nice simple syntax
- X - and above all, pleasant and easy to use.
- X
- X.nl .p .p
- X--
- X
- X.scrollb .p .p .clear
- XSo - What can you do with ASP ? (I hear you scream)
- X
- X.show .p .p
- X(apart from flashing messages like this on and off of the screen)
- X
- X.speed 20 .flash
- X flashing
- X
- X.speed 0 .clear .p .p
- X--
- X
- X.scrollf .p .p
- XYou can scroll a piece of text onto the screen line, either forwards...
- X
- X.scrollb .p .p
- X ...or backwards onto the screen (just like this !)
- X
- X.scrollof .p .p
- XOr what you have on the screen already can be scrolled off to the right ----->
- X
- X.scrollob .p .p .wipe
- X<----------------- and ditto off to the left, as you might expect.
- X
- X.spatter .p .p .wipe
- X You can spatter bits of text onto the screen
- X
- X.show .p .p .fade .p
- X and then just let them fade into nothingness....
- X
- X.layf .p .p .wipe
- X Messages can be laid down letter by letter, from left to right;
- X
- X.layb .p .p .wipe
- X ...and of course, ditto for messages right to left.
- X
- X.laymte .p .p .wipe
- X Then there is laying messages down from the middle to the ends of the screen
- X
- X.layetm .p .p .wipe
- X - and vice versa for messages, ends to middle.
- X
- X.laymte
- X really build up some these...
- X
- X.layetm
- X You can really build up some quite complex
- X
- X.laymte .p .p .fade .wipe
- X You can really build up some quite complex special effects with only these...
- X
- X.letter1
- Xbut thats nothing compared to what you can do with the special text functions.
- XBUT THATS NOTHING COMPARED TO WHAT YOU CAN DO WITH THE SPECIAL TEXT FUNCTIONS.
- XBut thats nothing compared to what you can do with the special text functions.
- X
- X.wipe .p .p
- X--
- X
- X.letter2
- X ESPECIALLY when YOU employ THE RANDOM-character-SEARCH macros.
- X
- X.letter1
- X especially WHEN you EMPLOY the random-CHARACTER-search MACROS.
- X esPECIALLY when yoU emPLOY the random-chARACTER-sEARCH macros.
- X ESPEcially wHEN YOu EMPloy THE RANDOM-character-SEarch macROS.
- X especiALLY whEN you EMPLoy the ranDOM-CHARacter-seaRCH macROS.
- X Especially when you employ the random-character-search macros.
- X
- X.clear .p .p
- X--
- X
- X.show .p .p .clear
- X But the thing that really "made it" in my mind, was animation.
- X Foregrounds and backgrounds.
- X The whole kaboodle.
- X
- X.p .p .show .p .p
- XAnd thus was born the Andalusian Video Snail:
- X
- X.object \@_ 100 50 .anim .resetanim .p .p
- X--
- X
- X.object _@_ 50 50 .anim .resetanim .p
- X--
- X
- X.object _@/ 50 100 .anim .resetanim .p .p
- X--
- X
- X.tshow .p .p .clear
- X And everyone copied it... Foo !
- X
- X.show .p .p .wipe
- X 8)
- X Oh well. Back to the hack. See you again soon.
- X ps: a copy of the asp source code for this plan can be found in the file
- X
- X.show \
- X.object ----> 0 74 \
- X.object <---- 74 0 \
- X.anim .resetanim \
- X.object ----> 0 74 \
- X.object <---- 74 0 \
- X.anim .resetanim \
- X.show
- X "demo3.asp" in the standard asp distribution.
- X
- X.nl .show .p
- X Bye Now...
- X Alec D.E. Muffett
- X (c) 1991
- END_OF_FILE
- if test 4739 -ne `wc -c <'demo3.asp'`; then
- echo shar: \"'demo3.asp'\" unpacked with wrong size!
- fi
- # end of 'demo3.asp'
- fi
- if test -f 'demo4.asp' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'demo4.asp'\"
- else
- echo shar: Extracting \"'demo4.asp'\" \(3434 characters\)
- sed "s/^X//" >'demo4.asp' <<'END_OF_FILE'
- X.clear .p .scrollf .p .p
- X Hello.
- X
- X.scrollob .p .p
- X I'm sad. 8(
- X
- X.scrollof .p .p
- X Do you know why I'm sad ?
- X
- X.scrollob .p .p
- X No, you wouldn't. Why would you care ?
- X
- X.scrollof .p .p
- X Do you want to know why I'm sad ?
- X
- X.scrollob .p .p
- X No, you still wouldn't. Why would you care ?
- X
- X.scrollof .object \@_ 85 0 .anim .resetanim
- X Is it because my Andalusian Video snail escaped ?
- X
- X.scrollob .p .p
- X Look ! There it goes now !!!
- X
- X.scrollof .p .p
- X No...
- X
- X.scrollob .p .p .fade .p
- X It's not that.
- X
- X.spatter .p .p .fade
- X Is it because I've been listening to too many Joy Division tracks ?
- X I don't think so...
- X I haven't been listening to ANY Joy Division Tracks...
- X
- X.object _@/ -5 80 .anim .resetanim
- X--
- X
- X.wspatter .p .p .wipe .p
- X There it goes again.
- X Bloody snail.
- X I'm not really sure *WHY* I'm sad.
- X after all...
- X
- X.wspatter .p .p .fade .p
- X there aren't many screen drivers that can fade messages into nothingness...
- X
- X.spatter .p .p .clear .p
- Xor others which magic them up from nothingness, only to wipe them into oblivion
- X
- X.scrollf .p .p
- X Scroll them in from the left
- X
- X.scrollob .p .p
- X .thgir eht morf ni meht llorcS
- X.wipe
- X--
- X
- X.speed 4 .wspatter .wipe .wspatter .wipe .wspatter .wipe .wspatter .wipe
- X Flashing messages seem to be very much in vogue at the moment.
- X Flashing messages seem to be very much in vogue at the moment.
- X Flashing messages seem to be very much in vogue at the moment.
- X Flashing messages seem to be very much in vogue at the moment.
- X
- X.speed 15 .show
- X I don't like this style of flashing very much to tell the truth...
- X
- X.flash .wipe
- X this flashing
- X
- X.speed 15 .p .wspatter .p
- X Words can just be laid down in any old order you like, no problems at all...
- X
- X.speed 0 .wipe
- X--
- X
- X.layetm
- X whether it is worth it
- X all, being a microprocessor.
- X Sometimes I really wonder
- X
- X.wipe .p
- X--
- X
- X.laymte
- X should have been a
- X like my mother wanted.
- X Or whether I
- X Scientific Calculator,
- X
- X.wipe .p
- X--
- X
- X.speed 0 .p .clear .p .show .p
- X I ALWAYS WANTED TO BE A FRUIT MACHINE !!!!
- X
- X.wipe .layb .p .fade
- X I wanted the fame !
- X.wipe .layf .p .fade
- X I wanted the high life !
- X.wipe .layb .p .fade
- X But most of all....
- X
- X.show .p .p .fade
- X I WANTED THE MONEY !
- X
- X.speed 20 .spatter .p .wipe
- X Oh well.
- X.speed 2 \
- X.object his -30 40 \
- X.object dreams, -50 44 \
- X.object computer -15 22 \
- X.object he -2 58 \
- X.object ? -250 61 \
- X.object can 89 31 \
- X.object have 100 35 \
- X.object can 111 52 \
- X.object A 150 20 \
- X.object 't 200 55 \
- X.anim .resetanim .p .p .p .nl
- X--
- X
- X.show .p .p .nl .wipe
- X Alec D.E. Muffett
- X (using asp 3.2)
- END_OF_FILE
- if test 3434 -ne `wc -c <'demo4.asp'`; then
- echo shar: \"'demo4.asp'\" unpacked with wrong size!
- fi
- # end of 'demo4.asp'
- fi
- if test -f 'demo5.asp' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'demo5.asp'\"
- else
- echo shar: Extracting \"'demo5.asp'\" \(5152 characters\)
- sed "s/^X//" >'demo5.asp' <<'END_OF_FILE'
- X.letter2 .p .wipe
- X Now it's my turn to show off and show these upstarts whats IT is all about!
- X
- X.letter3
- X I spent an hour bolting a few extra effects onto ASP (v3.1) today...
- X
- X.speed 10 .flash .flash .speed 0 .p .wipe
- X v3.1
- X
- X.letter1 .p
- X Setting up all sorts of miscellaneous effects which I'm not going to explain.
- X
- X.smooth 1 .scrollob .p
- X I'll just let you watch what effect they have on the output. Okey-dokey ?
- X(Oh yes, Alun, I did spot the optimisation. Looks much better now, doesn't it?)
- X
- X.clear .p
- X--
- X
- X.laymte
- X First things first.
- X a space invaders gun.
- X Kev, your spider looks like
- X
- X.p .p .wipe
- X--
- X
- X.layetm
- X At least my snail LOOKS like a snail.
- X Pity I never brought the centipede out.
- X
- X.p .p .wipe
- X--
- X
- X.foreground
- X[-----> <-----]
- X
- X.scrollof
- X By centipede, of course, I mean this one...
- X
- X.p .scrollob
- X --
- X
- X.p .object nmmme -10 80 .anim .resetanim
- X--
- X
- X.foreground
- X
- X.p .p .wipe
- X--
- X
- X.show \
- X.object ----> 0 74 \
- X.object <---- 74 0 \
- X.anim .resetanim \
- X.object ----> 0 74 \
- X.object <---- 74 0 \
- X.anim .resetanim \
- X.show
- X Forgive me, but I'm going to bring out the flying arrows too. I Like them.
- X
- X.wipe .layf .p .p
- X I could always get back to basics I suppose. There are a few effects which
- X
- X.wipe .layb .p .p
- X have been grossly under-used since this .plan war took off.
- X
- X.wipe .spatter .p .p .fade
- XThese poor little effects just sit idle, languishing as an unused ASP operator.
- X They need the odd outing.
- X
- X.wipe .scrollf .p .p .wipe
- X Erm...
- X
- X.speed 10 .wspatter .speed 0 .p .wipe
- X Here's an idea! How about some hippy ethics to help pass the time ?
- X
- X.letter2 .p .wipe
- X Ban the bomb. I mean, if it's not too much trouble ? Ok, man ?
- X
- X.letter3 .p .wipe
- X Ban soap commercials on JANET!
- X Ban Baldness. Ban Mathematics.
- X Ban Hippies. Be Vegetarian. Real Veggie Hippies don't wear Leather.
- X
- X.p .show .clear
- X <my girlfriend told me this, so it must be true...>
- X
- X.wipe .wspatter .p .p
- X Hohum. Enough of the little in-jokes. Maybe I just ought to run the credits.
- X
- X.scrollof .p
- X First and probably least, Alun Jones, alj8. It's all his fault.
- X
- X.scrollob .p
- X And then kkb9, Kev Brooks, for doing such an awful effort I had to do one too.
- X (He's improved a lot now, by the way. Not TOO much though)
- X
- X.scrollof .p
- X Simon Y Sais, ssw9, who never really got the hang of it, even if it was in 'C'
- X
- X.scrollof
- X [What IS the difference between C on UNIX and anywhere else, Simon?)
- X
- X.flash .flash .p
- X IS C UNIX
- X
- X.scrollob .p
- XCarl the hard-coding Hippy (ckw0), and JD (ccs7) for competition and enthusiasm
- X (respectively)
- X
- X.speed 10 .wipe .wspatter .wipe .wspatter .wipe .wspatter .wipe .wspatter .show
- X and all my friends: Gilly, Alun (Baronson), Michelle, Daniel and the Plyn Mob.
- X
- X.flash .flash
- X Gilly
- X
- X.wipe .p .show .p .clear
- X (Now you've had your names in lights, so push off!)
- X
- X.spatter .nl .p .flush
- X At least I haven't succumbed to the temptation of
- X
- Xsysdd:/var: write failed, file system full
- X
- Xsysdd:/var: write failed, file system full
- X
- Xsysdd:/var: write failed, file system full
- X
- Xsysdd:/var: write failed, file system full
- X
- Xsysdd:/var: write failed, file system full
- X
- Xsysdd:/var: write failed, file system full
- X
- Xsysdd:/var: write failed, file system full
- X
- Xsysdd:/var: write failed, file system full
- X
- Xsysdd:/var: write failed, file system full
- X
- Xsysdd:/var: write failed, file system full
- X
- Xsysdd:/var: write failed, file system full
- X
- Xsysdd:/var: write failed, file system full
- X
- Xsysdd:/var: write failed, file system full
- X
- Xsysdd:/var: write failed, file system full
- X
- Xsysdd:/var: write failed, file system full
- X
- Xsysdd:/var: write failed, file system full
- X
- Xsysdd:/var: write failed, file system full
- X
- Xsysdd:/var: write failed, file system full
- X
- Xsysdd:/var: write failed, file system full
- X
- Xsysdd:/var: write failed, file system full
- X
- Xsysdd:/var: write failed, file system full
- X
- Xsysdd:/var: write failed, file system full
- X
- Xsysdd:/var: write failed, file system full
- X
- Xsysdd:/var: write failed, file system full
- X
- Xsysdd:/var: write failed, file system full
- X
- Xsysdd:/var: write failed, file system full
- X
- Xsysdd:/var: write failed, file system full
- X
- Xsysdd:/var: write failed, file system full
- X
- Xsysdd:/var: write failed, file system full
- X
- Xsysdd:/var: write failed, file system full
- X
- Xsysdd:/var: write failed, file system full
- X
- Xsysdd:/var: write failed, file system full
- X
- Xsysdd:/var: write failed, file system full
- X
- Xsysdd:/var: write failed, file system full
- X
- Xsysdd:/var: write failed, file system full
- XConnection closed.
- X
- X.p .p .p .p .p .p
- X--
- X
- X.show .nl
- X <grin!>
- END_OF_FILE
- if test 5152 -ne `wc -c <'demo5.asp'`; then
- echo shar: \"'demo5.asp'\" unpacked with wrong size!
- fi
- # end of 'demo5.asp'
- fi
- if test -f 'display.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'display.c'\"
- else
- echo shar: Extracting \"'display.c'\" \(4191 characters\)
- sed "s/^X//" >'display.c' <<'END_OF_FILE'
- X/*
- X * This code is copyright ADE Muffett, September 1991, and is distributed as
- X * part of the ASP .plan description language compiler. This code is freely
- X * redistributable as long as this copyright notice remains intact. No
- X * responsibility is assumed by the author for any situation which arises
- X * from the use of this code, including insanity, late nights, or disk
- X * storage problems.
- X */
- X
- X#include "asp.h"
- X#undef DEBUG
- X
- Xstatic char currline[SCREENWIDTH + 1]; /* The state of the union... */
- X
- X/* nothing */
- Xvoid
- XNoop ()
- X{
- X}
- X/* Throw a newline */
- Xvoid
- XLineFeed ()
- X{
- X static char lf = '\n';
- X
- X putchar (lf);
- X NullSet (currline, sizeof (currline));
- X SpaceFlood (currline, sizeof (currline));
- X currline[SCREENWIDTH] = '\0';
- X}
- X/* Throw a carriage return */
- Xvoid
- XCReturn ()
- X{
- X static char cr = '\r';
- X
- X putchar (cr);
- X}
- X/* Fast clear of the current line */
- Xvoid
- XWipe ()
- X{
- X NullSet (stdline, sizeof (stdline));
- X}
- X/* Fast clear of the current line */
- Xvoid
- XClear ()
- X{
- X Wipe ();
- X UpdateCR ();
- X}
- X/* show something onto screen destructively */
- Xvoid
- XShow (cstring, dstring)
- X char *cstring;
- X char *dstring;
- X{
- X Wipe ();
- X Overlay (stdline, dstring);
- X UpdateCR ();
- X}
- X/* show something onto screen non destructively */
- Xvoid
- XTShow (cstring, dstring)
- X char *cstring;
- X char *dstring;
- X{
- X TransparentOverlay (stdline, dstring);
- X UpdateCR ();
- X}
- X/* Pause about 1 second @ 9600 baud */
- Xvoid
- XPause ()
- X{
- X register int i;
- X
- X for (i = 0; i < LOOP_COUNT; i++)
- X {
- X CReturn ();
- X }
- X for (i = (LOOP_COUNT * (speed / DUMMY_RETURNS)); i; i--)
- X {
- X CReturn ();
- X }
- X}
- X/* Trim off all whitespace from a text line */
- Xvoid
- XTrim (ptr)
- X register char *ptr;
- X{
- X while (*ptr)
- X {
- X ptr++;
- X }
- X while (isspace (*(--ptr)));
- X *(++ptr) = '\0';
- X}
- X/* the display primitive */
- Xint
- XUpdate ()
- X{
- X register int i;
- X int j;
- X int print_anim;
- X int print_stdline;
- X char diffline[SCREENWIDTH + 1];
- X
- X /* fix up all spaces */
- X SpaceFlood (background, SCREENWIDTH);
- X background[SCREENWIDTH] = '\0';
- X Trim (background);
- X
- X SpaceFlood (stdline, SCREENWIDTH);
- X stdline[SCREENWIDTH] = '\0';
- X Trim (stdline);
- X
- X SpaceFlood (anim_buffer, SCREENWIDTH);
- X anim_buffer[SCREENWIDTH] = '\0';
- X Trim (anim_buffer);
- X
- X SpaceFlood (foreground, SCREENWIDTH);
- X foreground[SCREENWIDTH] = '\0';
- X Trim (foreground);
- X
- X#ifdef DEBUG
- X printf ("bg'%s'\n", background);
- X printf ("st'%s'\n", stdline);
- X printf ("ab'%s'\n", anim_buffer);
- X printf ("fg'%s'\n", foreground);
- X#endif
- X
- X /* zero the differences buffer */
- X NullSet (diffline, sizeof (diffline));
- X SpaceFlood (diffline, SCREENWIDTH);
- X diffline[SCREENWIDTH] = '\0';
- X
- X TransparentOverlay (diffline, background);
- X TransparentOverlay (diffline, stdline);
- X TransparentOverlay (diffline, anim_buffer);
- X TransparentOverlay (diffline, foreground);
- X Trim (diffline);
- X
- X /* and tidy up the memory copy of the current line */
- X Trim (currline); /* this is what the screen is */
- X
- X i = strlen (diffline);
- X j = strlen (currline);
- X if (i < j)
- X {
- X for (; i < j && i < SCREENWIDTH; i++)
- X {
- X diffline[i] = ' ';
- X }
- X diffline[j] = '\0';
- X }
- X diffline[SCREENWIDTH] = '\0';
- X
- X /* there is a difference between screen and stdline+overstrikes */
- X if (strcmp (currline, diffline))
- X {
- X char printline[SCREENWIDTH + 1];
- X
- X /* backup diffline */
- X Memcpy (printline, diffline, sizeof (printline));
- X
- X /* don't print common trailing characters except space */
- X if ((i = strlen (currline)) == strlen (diffline))
- X {
- X while (i-- && (diffline[i] == currline[i]))
- X {
- X printline[i] = '\0';
- X }
- X }
- X /* print only what is necessary to make changes */
- X printf ("%s", printline);
- X
- X /* make diffline the current line */
- X Memcpy (currline, diffline, sizeof (currline));
- X
- X /* fill out line */
- X return (strlen (printline));
- X } else
- X {
- X return (SCREENWIDTH);
- X }
- X}
- X/* save typing */
- Xvoid
- XUpdateCR ()
- X{
- X register int i;
- X
- X i = Update ();
- X CReturn ();
- X
- X while (smooth && (i++ < SCREENWIDTH))
- X {
- X CReturn ();
- X }
- X
- X for (i = 0; i < (speed * DUMMY_RETURNS); i++)
- X {
- X CReturn ();
- X }
- X}
- X/* END OF DISPLAY PRIMITIVES */
- END_OF_FILE
- if test 4191 -ne `wc -c <'display.c'`; then
- echo shar: \"'display.c'\" unpacked with wrong size!
- fi
- # end of 'display.c'
- fi
- echo shar: End of archive 1 \(of 2\).
- cp /dev/null ark1isdone
- MISSING=""
- for I in 1 2 ; do
- if test ! -f ark${I}isdone ; then
- MISSING="${MISSING} ${I}"
- fi
- done
- if test "${MISSING}" = "" ; then
- echo You have unpacked both archives.
- rm -f ark[1-9]isdone
- else
- echo You still need to unpack the following archives:
- echo " " ${MISSING}
- fi
- ## End of shell archive.
- exit 0
- exit 0 # Just in case...
- --
- Kent Landfield INTERNET: kent@sparky.IMD.Sterling.COM
- Sterling Software, IMD UUCP: uunet!sparky!kent
- Phone: (402) 291-8300 FAX: (402) 291-4362
- Please send comp.sources.misc-related mail to kent@uunet.uu.net.
-